package com.cby.project.mvi.model

import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.flow.onCompletion
import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.flow.onStart
import kotlinx.coroutines.launch

/**
 * @description: NetworkViewModel
 *
 * @author ChenBaoyang
 * @date 2021/12/3 16:43
 */
class NetworkViewModel : ViewModel() {

    /**
     * 页面请求，通常包括刷新页面loading状态等
     */
    private fun pageRequest() {
        viewModelScope.launch {
            flow {
                delay(2000)
                emit("页面请求成功")
            }.onStart {

            }.onEach {

            }
        }
    }
}